<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
       
       <h:body>
       	<script type="text/javascript">  
		    function handleLoginRequest(xhr, status, args) {  
		        if(args.validationFailed) {  
		        	loginDlg.jq.effect("shake", { times:5 }, 100);  
		        }   
		    }  
		</script>  
	  	<h:form>	
	  	    <p:messages id="loginMsgs"></p:messages>
			<p:dialog id="loginDlg" widgetVar="loginDlg" closable="false" visible="true" 
			          modal="true" header="Se connecter..."  width="300" resizable="false"
			          showEffect="fade" hideEffect="fade" >

	           	<br/>
					<p:panelGrid id="loginGrid" columns="2" cellspacing="5" >
						<h:outputLabel  value="Utilisateur : " />
						<p:inputText id="user" required="true" 
						             requiredMessage="-Login obligatoire"
						             value="#{userController.user.account.login}"/>
						             
	
						<h:outputLabel value="Mot de passe : " />	
						<p:password feedback="false" required="true" 
						            requiredMessage="-Mode de passe obligatoire" 
						            id="mdp" value="#{userController.user.account.password}"/> 
					</p:panelGrid>
					
	            <br/>
				    
				<f:facet name="footer"> 
				   <p:commandButton id="saveBtn" value="Entrer" widgetVar="saveBtn"
				                    icon="ui-icon-check" style="margin:0" 
				                    update="loginGrid, loginMsgs" oncomplete="handleLoginRequest(xhr, status, args)"
				                    action="#{userController.loginAction}"/>
				    
				</f:facet>
			</p:dialog>
			<p:blockUI block="loginDlg" trigger="saveBtn">  
		        Loading...<br />  
		        <p:graphicImage value="#{msg['images.loading.path']}"/>  
		    </p:blockUI>
        </h:form>
        
	  </h:body>
          
</html>
